# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Contributor: Jiri Kastner <cz172638@gmail.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
_pyname=cheroot
pkgname=py3-cheroot
pkgver=10.0.0
pkgrel=1
pkgdesc="High-performance, pure-Python HTTP server used by CherryPy"
url="https://cheroot.cherrypy.dev/"
license="BSD-3-Clause"
arch="noarch"
depends="python3 py3-more-itertools py3-jaraco.functools"
# py3-setuptools_scm is needed to set python module version
makedepends="
	py3-dateutil
	py3-gpep517
	py3-pbr
	py3-portend
	py3-setuptools
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="
	py3-jaraco.context
	py3-jaraco.text
	py3-openssl
	py3-pypytools
	py3-pytest
	py3-pytest-cov
	py3-pytest-mock
	py3-requests-unixsocket
	py3-requests-toolbelt
	py3-pytest-xdist
	py3-trustme
	"
subpackages="$pkgname-tests $pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/c/$_pyname/$_pyname-$pkgver.tar.gz
	setuptools-git.patch
	"
builddir="$srcdir/$_pyname-$pkgver"
options="!check" # fail on deprecation warning

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

tests() {
	depends="py3-cheroot"
	amove usr/lib/python*/site-packages/cheroot/test
}
sha512sums="
02e32e52a596463cbb9874a800dbcdc5680dd7d9dfa95ca6e73c81f9248a488087c514ae70cdba94fe9df1f5d3ab1c68efcb720561cbeb7b667109fe5962f85b  cheroot-10.0.0.tar.gz
7831aeeea0b6d1ed094c92eb697632395de903d5de170c37230db2b7d083041855473f8d50b93c1e2f630e0c411ccf5f909593b3160cb134339e9d3e21ed691c  setuptools-git.patch
"
